Generate Your Script

Pyramid's AI integration lets you use AI (powered by your underlying LLM engine) to generate SQL, SOQL, MDX, DAX, Python, or R statements. This may be useful if you want to generate code quickly, or aren't confident with the syntax that you need to use. To do this, click the Gen AI icon from the Properties panel, and then, in the text field at the top of the Generate Your Script dialog, enter a description of the query you want to perform.

  • Scripted Sources: generate a Python or R script and use it as a data source.
  • Scripting Nodes: generate Python or R scripts and inject them into the Data Flow.
  • Query Node: generate SQL, SOQL, MDX, or DAX scripts to run queries against a data source.
  • Master Flow: generate SQL expressions to directly query a database.

The Gen AI icon is present in the Properties panel. Click the icon to open the Generate Your Script dialog for the selected script type.

Generate Your Script dialog

The name of this dialog (title bar) indicates the type of script that you are creating. It contains the following fields and buttons:

  • Title: The name of the dialog.
  • Text Field: Type a prompt that describes the query you want your new script to perform (red highlight below). Click the arrow to enter your query description and return an AI generated script.
  • Schemas: (Query only.) The database schema (orange highlight below); you can select the dimensions, elements, and views that are relevant to your description to simplify the query. See below for more information.
  • Script Window: The AI-generated script opens in the scripting window (green highlight below).
  • Explain Code: Open a dialog containing an AI-generated explanation of the script in the scripting window (yellow arrow below).
  • Apply: Apply the script to the Query node.
  • Cancel: Close the dialog without applying any changes.

Schemas panel

When generating a script for a Query node (SQL, SOQL, MDX, or DAX), the dialog includes a Schemas panel, which shows the database schema. You can use this panel to select the model data (dimensions, elements, and views) that are relevant to your script.

Selecting only relevant model data in this panel:

  • Simplifies the query, allowing the results to be generated and returned as quickly as possible. This is particularly important if you have a very large data model.
  • Excludes data from being passed to the LLM for analysis. This allows you to keep your data secure and private.

Tip: You can search the Schemas panel for particular objects. Click the magnifier (blue arrow, above) to open the search field and type either the first few characters in the object name or the asterisk wildcard (*) and a string contained anywhere in the object name.

Explaining the Script

Use the Explain Script function (arrow) to understand the current script by producing an AI-generated explanation of what it does. Each time you click the Explain Script button, a new explanation is generated. This explanation can be generated regardless of the method used to generate the script. For more information, see Explain Script.

Warning: AI-generated assets are generated from public domain algorithms, which can produce both erroneous and inconsistent or random results. Use at your own risk.